import React,{ Component } from 'react';
import {NavLink} from 'react-router-dom';
import './header.scss';
import {Icon} from 'antd';
import {withRouter} from 'react-router-dom';
// import {withRouter} from 'react-router-dom';



class Header extends Component {

  //跳转登录
  logninFunc=()=>{
    this.props.history.push('/center')
    // console.log("dadsfafsa登录")
  }
  //跳转购物车
  logninFunc3=()=>{
    this.props.history.push('/shoppingcart')
    // console.log("dadsfafsa登录")
  }
  render() {
    const pathname = this.props.location.pathname;
    return (
      <div>
        {
          pathname === '/' || pathname === '/mask' || pathname === '/life'|| pathname === '/global'?
          <div className="Header">
            <div className="Header_sousuo">
              <div className="Header_sousuo1" onClick={this.logninFunc}><Icon type="user" className="userr" /></div>
              <div className="Header_sousuo2"><Icon type="search" className="searchh" />面膜</div>
              <div className="Header_sousuo3" onClick={this.logninFunc3}><Icon type="shopping-cart" className="shopping-cart" /></div>
            </div>
            <nav >
              <ul className="topHeader">
                <li><NavLink exact to="/" activeClassName="active">今日推荐</NavLink></li>
                <li><NavLink to="/mask" activeClassName="active">面膜中心</NavLink></li>
                <li><NavLink to="/life" activeClassName="active">居家生活</NavLink></li>
                <li><NavLink to="/global" activeClassName="active">全球购</NavLink></li>
              </ul>
            </nav>
          </div>:""
        }
      </div>
    );
  }
}

export default withRouter(Header);